from apps.forms import BaseFrom
from wtforms import StringField,IntegerField,validators
from wtforms.validators import InputRequired,Regexp,Email,EqualTo


class LoginFrom(BaseFrom):
    contact = StringField(validators=[InputRequired(message='请输入用户名')])
    password = StringField(validators=[InputRequired(message='请输入密码')])


class RegistForm(BaseFrom):
    name = StringField(validators=[InputRequired(message='输入昵称')])
    email = StringField(validators=[Email(message='请输入正确的邮箱')])
    telephone = StringField(validators=[Regexp(r'1[35789]\d{9}'),InputRequired(message='请输入手机号')])
    password = StringField(validators=[Regexp(r'[0-9a-zA-Z!@##$]{6,20}'),InputRequired('请输入密码')])
    repassword = StringField(validators=[EqualTo('password')])